<template>
  <div class="change_admin">
    <el-dialog
      :title="title"
      class="gl_dialog_TitleLine"
      :visible.sync="dialogVisible"
      :close-on-click-modal="false"
      width="880px"
    >
      <el-form ref="form" class="gl_form_mini" :model="SiSTKWEventsManagementKyorugiSettingDto" :rules="CompetitiveDataVO_Rules" label-width="140px" label-position="right" style="padding-right: 30px;">
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="名称" prop="name" style="height:32px; box-sizing:border-box">
              <el-input v-model="SiSTKWEventsManagementKyorugiSettingDto.name" size="mini" clearable />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="身体阈值" prop="bodyThreshold">
              <el-input-number v-model="SiSTKWEventsManagementKyorugiSettingDto.bodyThreshold" :min="0" style="width:100%" size="mini" clearable />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="头部阈值" prop="headThreshold">
              <el-input-number v-model="SiSTKWEventsManagementKyorugiSettingDto.headThreshold" :min="0" style="width:100%" size="mini" clearable />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="最大犯规" prop="maxFoul">
              <el-input-number v-model="SiSTKWEventsManagementKyorugiSettingDto.maxFoul" :min="0" style="width:100%" size="mini" clearable />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="青方审议" prop="gConsideration">
              <el-input-number v-model="SiSTKWEventsManagementKyorugiSettingDto.gConsideration" :min="0" style="width:100%" size="mini" clearable />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="红方审议" prop="rConsideration">
              <el-input-number v-model="SiSTKWEventsManagementKyorugiSettingDto.rConsideration" :min="0" style="width:100%" size="mini" clearable />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="回合数" prop="rounds">
              <el-input-number v-model="SiSTKWEventsManagementKyorugiSettingDto.rounds" :min="0" style="width:100%" size="mini" clearable />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="回合时间（分）" prop="roundMinutes">
              <el-input-number v-model="SiSTKWEventsManagementKyorugiSettingDto.roundMinutes" :min="0" style="width:100%" size="mini" clearable />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="回合时间（秒）" prop="roundSeconds">
              <el-input-number v-model="SiSTKWEventsManagementKyorugiSettingDto.roundSeconds" :min="0" :max="60" style="width:100%" size="mini" clearable />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="休息时间（分）" prop="breakMinutes">
              <el-input-number v-model="SiSTKWEventsManagementKyorugiSettingDto.breakMinutes" :min="0" style="width:100%" size="mini" clearable />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="休息时间（秒）" prop="breakSeconds">
              <el-input-number v-model="SiSTKWEventsManagementKyorugiSettingDto.breakSeconds" :min="0" :max="60" style="width:100%" size="mini" clearable />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="计时时间（分）" prop="timingMinutes">
              <el-input-number v-model="SiSTKWEventsManagementKyorugiSettingDto.timingMinutes" :min="0" style="width:100%" size="mini" clearable />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="计时时间（秒）" prop="timingSeconds">
              <el-input-number v-model="SiSTKWEventsManagementKyorugiSettingDto.timingSeconds" :min="0" :max="60" style="width:100%" size="mini" clearable />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="加时赛时间（分）" prop="extraMinutes">
              <el-input-number v-model="SiSTKWEventsManagementKyorugiSettingDto.extraMinutes" :min="0" style="width:100%" size="mini" clearable />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="加时赛时间（秒）" prop="extraSeconds">
              <el-input-number v-model="SiSTKWEventsManagementKyorugiSettingDto.extraSeconds" :min="0" :max="60" style="width:100%" size="mini" clearable />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="加时赛分数" prop="extraScore">
              <el-input-number v-model="SiSTKWEventsManagementKyorugiSettingDto.extraScore" :min="0" style="width:100%" size="mini" clearable />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button size="mini" @click="close('form')">{{ $t('button.cancel') }}</el-button>
        <el-button type="primary" size="mini" @click="saveEdit('form')">{{ $t('button.save') }}</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { SiSTKWEventsManagementKyorugiSettingDto } from '@/lib/form/game/swaggerForm';
import { CompetitiveDataVO_Rules } from '@/lib/validate/configuration/index.js';
import { CopyData } from '@/lib';
export default {
  name: 'Account',
  data() {
    return {
      SiSTKWEventsManagementKyorugiSettingDto: new SiSTKWEventsManagementKyorugiSettingDto(),
      CompetitiveDataVO_Rules: new CompetitiveDataVO_Rules(),
      title: '', // 弹框标题
      dialogVisible: false,
      currentData: [],
      row: 0,
      inputDataName: ''
      // editData: []
    };
  },
  watch: {
    dialogVisible(val) {
      if (!val) {
        this.$refs['form'].resetFields();
      }
    }
  },
  methods: {
    open(row) {
      if (row) {
        this.title = '编辑';
        this.SiSTKWEventsManagementKyorugiSettingDto = JSON.parse(JSON.stringify(row));
        this.editData = JSON.parse(JSON.stringify(row));
        this.inputDataName = JSON.parse(JSON.stringify(row.name));
      } else {
        this.title = '新增';
        this.SiSTKWEventsManagementKyorugiSettingDto = JSON.parse(JSON.stringify(new SiSTKWEventsManagementKyorugiSettingDto()));
        this.row = row;
      }
      this.dialogVisible = true;
    },
    close() {
      this.$refs.form.resetFields();
      this.dialogVisible = false;
    },
    // 点击确定
    saveEdit(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          const returnData = new SiSTKWEventsManagementKyorugiSettingDto();
          CopyData(this.SiSTKWEventsManagementKyorugiSettingDto, returnData);
          if (this.title === '新增') {
            this.$emit('pushTabelData', returnData);
          } else {
            var editData = JSON.parse(JSON.stringify(this.SiSTKWEventsManagementKyorugiSettingDto));
            this.$emit('editTabelData', editData);
          }
        } else {
          return false;
        }
      });
    }
  }
};
</script>

